package com.ft.web.viewmodel;

import com.alibaba.fastjson.annotation.JSONField;
import com.ft.core.service.dto.BaseDto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.ArrayList;
import java.util.List;

/**
 * @copyright (C), 2015-2019, XXX有限公司
 * @fileName: ReactMenuItemModel
 * @author: 李阳
 * @date: 2019/7/11 22:57
 * @description: 基于React的路由模型
 * @history: <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class ReactMenuItemModel extends BaseDto {
    private static final long serialVersionUID = 2478502365469277771L;

    public ReactMenuItemModel() {
        this.authority = new ArrayList<>();
        this.children = new ArrayList<>();
    }

    @ApiModelProperty(value = "菜单项的路由地址")
    @JSONField(ordinal = 1)
    private String path;

    @ApiModelProperty(value = "菜单项的组件路径")
    @JSONField(ordinal = 2)
    private String component;

    @ApiModelProperty(value = "菜单项的文本")
    @JSONField(ordinal = 3)
    private String name;

    @ApiModelProperty(value = "菜单项的图标")
    @JSONField(ordinal = 4)
    private String icon = "home";

    @ApiModelProperty(value = "在菜单中不展示这个路由，包括子路由")
    @JSONField(ordinal = 5)
    private Boolean hideInMenu = false;

    @ApiModelProperty(value = "隐藏不需要在菜单中展示的子路由")
    @JSONField(ordinal = 6)
    private Boolean hideChildrenInMenu = false;

    @ApiModelProperty(value = "这个路由的权限，如果配置了将会验证当前用户的权限，并决定是否展示")
    @JSONField(ordinal = 7)
    private List<String> authority;

    @ApiModelProperty(value = "子路由集合")
    @JSONField(ordinal = 8)
    private List<ReactMenuItemModel> children;
}
